//
//  TTCollectionItem.swift
//  TTProduct-macOS
//
//  Created by Toj on 5/12/21.
//

import Cocoa

class TTCollectionItem: NSCollectionViewItem {
    
    var random: NSColor {
        let r = CGFloat(arc4random_uniform(256)) / 255
        let g = CGFloat(arc4random_uniform(256)) / 255
        let b = CGFloat(arc4random_uniform(256)) / 255
        
        return NSColor(calibratedRed: r, green: g, blue: b, alpha: 1)
    }
    
    override func loadView() {
        view = NSView()
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.wantsLayer = true
        view.layer?.backgroundColor = random.cgColor
    }
}
